package com.allen.app.zdemo.service;

import cn.hutool.log.StaticLog;
import com.allen.app.common.config.aspect.DistributedLock;
import com.allen.app.zdemo.mapper.RabbitmqDatasMapper;
import java.util.List;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Service
@Slf4j
@AllArgsConstructor
public class TestService {
    private RabbitmqDatasMapper rabbitmqDatasMapper;

    private static int a = 0;
    @SneakyThrows
    @DistributedLock(name = "#name")
    public void testDistributedLock(Integer name){

        StaticLog.info("allen>>>\t{}-{}",name,++a);
    }

    public List<Map<String,Object>> selectMapList(){
        return this.rabbitmqDatasMapper.selectMapList();
    }
}
